package com.tiantianfresh.admin.service.Impl;

import com.tiantianfresh.model.dao.RoleMapper;
import com.tiantianfresh.model.pojo.Role;
import com.tiantianfresh.admin.service.RoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author FANGAO
 * @date 2021/11/13 - 下午 17:20
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Resource
    private RoleMapper roleMapper;

    @Override
    public int roleTotalCount(String queryText) {
        return roleMapper.roleTotalCount(queryText);
    }

    @Override
    public List<Role> getListRole(Map<String, Object> map) {
        return roleMapper.getListRole(map);
    }

    @Override
    public boolean insert(Role role) {
        if (roleMapper.insert(role)>0) return true;
        return false;
    }

    @Override
    public boolean roleUpdate(Role role) {
        if (roleMapper.roleUpdate(role)>0) return true;
        return false;
    }

    @Override
    public Role queryByid(Integer id) {
        return roleMapper.queryByid(id);
    }

    @Override
    public boolean roleDelete(Integer id) {
        if (roleMapper.roleDelete(id)>0) return true;
        return false;
    }

    @Override
    public boolean deleteRoles(Map<String, Object> map) {
        if (roleMapper.deleteRoles(map)>0) return true;
        return false;
    }

    @Override
    public List<Role> getRoles() {
        return roleMapper.getRoles();
    }

    @Override
    public boolean insertRolePermission(Map<String, Object> map) {
        if (roleMapper.insertRolePermission(map)>0) return true;
        return false;
    }

    @Override
    public void deleteRolePermission(Map<String, Object> map) {
        roleMapper.deleteRolePermission(map);
    }
}
